import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
    {
        path: '/',
        name: 'Home',
        component: () => import('@/views/Home.vue'),
        redirect: '/first',
        children: [{
            path: '/first',
            name: 'first',
            component: () => import('@/views/firstPage/first.vue'),
            meta: {
                title: '首页'
            }
        }]
    },
    {
        path: '/home',
        name: 'Home1',
        redirect: '/404',
        meta: {
            title: '商品管理'
        },
        component: () => import('@/views/Home.vue'),
        children: [
            {
                path: 'shopList',
                name: 'shopList',
                component: () => import('@/views/ShopList/shopList.vue'),
                meta: {
                    title: '商品列表'
                }
            },
            {
                path: 'shelves',
                name: 'shelves',
                component: () => import('@/views/Reviews/shelves.vue'),
                meta: {
                    title: '商品上架'
                }
            },
            {
                path: 'comments',
                name: 'comments',
                component: () => import('@/views/Added/comments.vue'),
                meta: {
                    title: '商品评论'
                }
            },
            {
                path: 'compile',
                name: 'compile',
                component: () => import('@/views/Reviews/shelves.vue'),
                meta: {
                    title: '商品编辑'
                }
            }
        ]
    },
    ,
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/Login.vue')
    }
]


// 3. 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置，但我们在这里
// 暂时保持简单
const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
})

export default router